﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
public partial class App_MasterPages_MainMasterPage : System.Web.UI.MasterPage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string filePath = Server.MapPath("~\\Files\\SentenceFile.txt");
        //Response.AddFileDependency(filePath);      
        //Response.Cache.SetExpires(DateTime.Now.AddDays(30));
        //Response.Cache.SetCacheability(HttpCacheability.Public);
        //Response.Cache.SetValidUntilExpires(true);


        if (!Page.IsPostBack)
            sentenceSpan.InnerText = ReadSentenceFile(filePath);

        if (Session["ExceptionHandler"] != null)
            Page.ClientScript.RegisterClientScriptBlock(Page.GetType(), "ExceptionHandler", string.Format("showModalDialog('{0}/ExceptionManagement/ExceptionHandler.aspx','', 'dialogWidth:390px;dialogHeight:360px;center:yes;status:no;scroll:no', '');", Request.ApplicationPath), true);
    }

    private string ReadSentenceFile(string filePath)
    {    
        StreamReader streamReader = File.OpenText(filePath);
        return streamReader.ReadToEnd();
    }
}
